# Raw HTML
Text between < and > that looks like an HTML tag is parsed as a raw HTML tag and will be rendered in HTML without escaping. Tag and attribute names are not limited to current HTML tags, so custom tags (and even, say, DocBook tags) may be used.
Here is the grammar for tags:
A tag name (opens new window) consists of an ASCII letter followed by zero or more ASCII letters, digits, or hyphens (-).
An attribute (opens new window) consists of whitespace (opens new window), an attribute name (opens new window), and an optional attribute value specification (opens new window).
An attribute name (opens new window) consists of an ASCII letter, _, or :, followed by zero or more ASCII letters, digits, _, ., :, or -. (Note: This is the XML specification restricted to ASCII. HTML5 is laxer.)
An attribute value specification (opens new window) consists of optional whitespace (opens new window), a = character, optional whitespace (opens new window), and an attribute value (opens new window).
An attribute value (opens new window) consists of an unquoted attribute value (opens new window), a single-quoted attribute value (opens new window), or a double-quoted attribute value (opens new window).
An unquoted attribute value (opens new window) is a nonempty string of characters not including whitespace (opens new window), ", ', =, <, >, or `.
A single-quoted attribute value (opens new window) consists of ', zero or more characters not including ', and a final '.
A double-quoted attribute value (opens new window) consists of ", zero or more characters not including ", and a final ".
An open tag (opens new window) consists of a < character, a tag name (opens new window), zero or more attributes (opens new window), optional whitespace (opens new window), an optional / character, and a > character.
A closing tag (opens new window) consists of the string </, a tag name (opens new window), optional whitespace (opens new window), and the character >.
An HTML comment (opens new window) consists of <!-- + text + -->, where text does not start with > or ->, does not end with -, and does not contain --. (See the HTML5 spec (opens new window).)
A processing instruction (opens new window) consists of the string <?, a string of characters not including the string ?>, and the string ?>.
A declaration (opens new window) consists of the string <!, a name consisting of one or more uppercase ASCII letters,whitespace (opens new window), a string of characters not including the character >, and the character >.
A CDATA section (opens new window) consists of the string <![CDATA[, a string of characters not including the string ]]>, and the string ]]>.
An HTML tag (opens new window) consists of an open tag (opens new window), a closing tag (opens new window), an HTML comment (opens new window), a processing instruction (opens new window), a declaration (opens new window), or a CDATA section (opens new window).
Here are some simple open tags:
Example 632
| Markdown | HTML | Demo |
|---|---|---|
|
|
Empty elements:
Example 633
| Markdown | HTML | Demo |
|---|---|---|
|
|
Whitespace (opens new window) is allowed:
Example 634
| Markdown | HTML | Demo |
|---|---|---|
|
|
With attributes:
Example 635
| Markdown | HTML | Demo |
|---|---|---|
|
|
Custom tag names can be used:
Example 636
| Markdown | HTML | Demo |
|---|---|---|
|
|
Illegal tag names, not parsed as HTML:
Example 637
| Markdown | HTML | Demo |
|---|---|---|
|
|
Illegal attribute names:
Example 638
| Markdown | HTML | Demo |
|---|---|---|
|
|
Illegal attribute values:
Example 639
| Markdown | HTML | Demo |
|---|---|---|
|
|
Illegal whitespace (opens new window):
Example 640
| Markdown | HTML | Demo |
|---|---|---|
|
|
Missing whitespace (opens new window):
Example 641
| Markdown | HTML | Demo |
|---|---|---|
|
|
Closing tags:
Example 642
| Markdown | HTML | Demo |
|---|---|---|
|
|
Illegal attributes in closing tag:
Example 643
| Markdown | HTML | Demo |
|---|---|---|
|
|
Comments:
Example 644
| Markdown | HTML | Demo |
|---|---|---|
|
|
Example 645
| Markdown | HTML | Demo |
|---|---|---|
|
|
Not comments:
Example 646
| Markdown | HTML | Demo |
|---|---|---|
|
|
Processing instructions:
Example 647
| Markdown | HTML | Demo |
|---|---|---|
|
|
Declarations:
Example 648
| Markdown | HTML | Demo |
|---|---|---|
|
|
CDATA sections:
Example 649
| Markdown | HTML | Demo |
|---|---|---|
|
|
Entity and numeric character references are preserved in HTML attributes:
Example 650
| Markdown | HTML | Demo |
|---|---|---|
|
|
Backslash escapes do not work in HTML attributes:
Example 651
| Markdown | HTML | Demo |
|---|---|---|
|
|
Example 652
| Markdown | HTML | Demo |
|---|---|---|
|
|